const DB = wx.cloud.database().collection("aid_game_CarAccident")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    aid_game_CarAccident: [],
    car_title3_1: [],
    note: [],

    aid_game_Drowning: [],
    aid_car:[],
    hcar_help: true,
    hcar_left: true,
    hcar_no: true,
    hcar_yes: true,
    hordinary: true,
    hfracture: true,
    hcoma: true,
    hbleeding: true,
  },

  // 帮助
  car_help: function (e) {
    this.setData({
      hcar_help: !this.data.hcar_help,
      hcar_left: true
    })
  },
  // 离开
  car_left: function (e) {
    this.setData({
      hcar_left: !this.data.hcar_left,
      hcar_help: true,

    })
  },
  // 没有
  car_no: function (e) {
    this.setData({
      hcar_no: !this.data.hcar_no,
      hcar_yes: true,
      hcar_you: true,
    })
  },
  // 有
  car_yes: function (e) {
    this.setData({
      hcar_yes: !this.data.hcar_yes,
      hcar_no: true,
    })
  },
  // 普通伤员
  ordinary: function (e) {
    this.setData({
      hordinary: !this.data.hordinary,
      hfracture: true,
      hcoma: true,
      hbleeding: true,
    })
  },
  // 骨折伤员
  fracture: function (e) {
    this.setData({
      hfracture: !this.data.hfracture,
      hordinary: true,
      hcoma: true,
      hbleeding: true,
    })
  },
  // 昏迷伤员
  coma: function (e) {
    this.setData({
      hcoma: !this.data.hcoma,
      hordinary: true,
      hfracture: true,
      hbleeding: true,
    })
  },
  // 出血伤员
  bleeding: function (e) {
    this.setData({
      hbleeding: !this.data.hbleeding,
      hordinary: true,
      hfracture: true,
      hcoma: true,
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    //滚动播报连接数据库aid_swiper
    DB.get({
      success: res => {
        console.log(res.data)
        this.setData({
          aid_game_CarAccident: res.data,
          car_title3_1: res.data[0].car_title3_1.split("|"),
          note: res.data[0].note_1.split("|"),
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})